//===================================================================================
// $$
//
// Coder: Code Milker v1.0
// 0 - upper
// 1 - lower
//===================================================================================


namespace App.Domain.Handlers {
    using System;
    using App.Data;
    using App.Domain.Contracts;

    public class DeleteBulletin {
        private readonly IBulletinRepository _BulletinRepository;

        public DeleteBulletin(IBulletinRepository BulletinRepository) {
            _BulletinRepository = BulletinRepository;
        }

        public virtual void Execute(Guid bulletinId) {
            var BulletinToDelete = _BulletinRepository.GetBulletin(bulletinId);

            if (BulletinToDelete != null) {
                _BulletinRepository.Delete(bulletinId);
            }
            else {
                throw new BusinessServicesException("UnableToDeleteVehicleExceptionMessage");
            }
        }
    }
}
